#include <cstdio>

int main( )
{
    int n;
    while ( scanf("%d", &n) && n )
        printf("%d\n", ( n - 1 ) >> 1);
    return 0;
}
